package dao;

import domain.email;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import util.JDBCUtils;

import java.util.List;
import java.util.Map;

//操作curd
public class emailDao {
    private JdbcTemplate temp= new JdbcTemplate(JDBCUtils.getDataSource());


    /**
     * 查询
     * @param t 一个携带email地址的email
     * @return 如果查询到，就返回这个email，否则返回null
     */
    public email Query(email t){

        String sql="select * from Email where EmailStr = ?";
        email res = temp.queryForObject(sql,
                new BeanPropertyRowMapper<>(email.class),
                t.getEmailStr());

       return res;

    }

}
